<template>
  <ul ref="ulmain">
    <li class="nowTime">{{ fnowTime }}</li>

    <li :class="item.type=='robot'?'lfloat':'rfloat'" v-for="(item,index) in dialogue" ref="child" :key="index">
      <div class="pic"></div>

      <div class="txt">
        <div class="des">
          <p v-html="item.des"></p>
        </div>
      </div>
    </li>

  </ul>
</template>

<script>
import axios from "axios";
import _data from "../static/js/data.js";

export default {
  name: "Record",
  props: ["dialogue"],
  computed: {
    // 当前时间格式化
    fnowTime: () => {
      let time = new Date();
      let y = time.getFullYear();
      let m = time.getMonth() + 1;
      let d = time.getDate();
      let h = (time.getHours()+ 100).toString().slice(1);
      let min = (time.getMinutes()+ 100).toString().slice(1);
      let s = (time.getSeconds() + 100).toString().slice(1);
      return h + ":" + min;
    },
  },

  methods: {},
  created() {},
  mounted() {
    console.log(this.dialogue)
  },
};
</script>

<style>
.main ul {
  height: 100%;
  overflow-y: scroll;
  scroll-behavior: smooth;
}

.main li.nowTime {
  font-size: 0.28rem;
  text-align: center;
  color: #aaa;
  line-height: 0.8rem;
  margin:0;
}

.lfloat {
  float: left;
  text-align: left;
}
.rfloat {
  float: right;
  text-align: right;
}
.main li {
  width: 100%;
  box-sizing: border-box;
  padding: 0.1rem;
  margin: 0 0 0.3rem;
  *zoom: 1;
   word-break: break-all;
  /* display: none; */
}
.main li:after {
  content: "\20";
  clear: both;
  height: 0;
  display: block;
  overflow: hidden;
}
.lfloat .pic {
  width: 0.6rem;
  height: 0.6rem;
  float: left;
  margin-right: 0.15rem;
  border: 1px solid #fff;
  border-radius: 50%;
  background: url(../static/images/h.jpg) no-repeat 0 0 / contain;
}
.lfloat .txt {
  float: left;
  line-height: 1.6;
  font-size: 0.28rem;
  max-width: 5.2rem;
}
.txt b {
  line-height: 2.5;
}
.txt a {
  color: #61aeff;
}

.lfloat .txt .name {
  font-size: 0.16rem;
  margin-bottom: 0.05rem;
}
.lfloat .txt .des {
  box-sizing: border-box;
  padding: 0.15rem 0.3rem .13rem;
  background: #fff;
  border-radius: 0.13rem;
  text-align: justify;
  position: relative;
  border-top-left-radius: 0;
  border: 1px solid #f5f7fa;
  box-shadow: 1px 2px 6px #dbdffd;
}
hr {
  border-top: 1px solid #f5f5f5;
  margin: 0.05rem auto 0.2rem;
}

.rfloat .pic {
  width: 0.7rem;
  height: 0.7rem;
  float: right;
  border: 1px solid #fff;
  border-radius: 50%;
  margin-left: 0.15rem;
  background: url(../static/images/h_woman.png) no-repeat 0 0 / contain;
}
.rfloat .txt {
  float: right;
  line-height: 1.5;
  font-size: 0.28rem;
  max-width: 5.2rem;
}
.rfloat .txt .name {
  font-size: 0.16rem;
  margin-bottom: 0.05rem;
}
.rfloat p{width: 100%;}
.rfloat .txt .des {
  box-sizing: border-box;
  padding: 0.15rem 0.3rem .13rem;
  background: #61aeff;
  border-radius: 0.13rem;
  text-align: justify;
  position: relative;
  color: #fff;
  border-top-right-radius: 0;
  box-shadow: 1px 2px 8px #86bcfa;
}
</style>